/**
 * 定义站点地图实时数据模块
 */
(function(window, angular, undefined){
	var module = angular.module('water.apps.WasteWater.stationMap.mapManager', ['itfreer',
                                                                        'water.common.publishSubscribe',
                                                                        'water.apps.common.stationMap.stationMapRealDataManager',
	                                                                    'water.entity.district']);
		
	module.controller('mapController',function($gisObject,$scope,$districtService,$pubSubService,$controller){

		/**
		 * 继承地图实时数据
		 */
		var control = $controller("commonStationMapRealDataManagerController",{$scope:$scope});
		
		/**
		 * 政区面板是否显示
		 */
		$scope.areaShow = false;
		
		/**
		 * 选中的政区
		 */
		$scope.selectArea = "深圳市";

		/**
		 * 地图实时数据上显示的参数映射
		 * PH COD 氨氮 瞬时流量 累积流量 总铜 总磷 总镍 六价铬
		 */
		$scope.pollToList =[{name:"001",parmName:"pH"},{name:"011",parmName:"CODcr"},{name:"060",parmName:"氨氮"},{name:"B01",parmName:"瞬时流量"},{name:"B01TOTAL",parmName:"累积流量 "},
		                     {name:"029",parmName:"总铜"},{name:"101",parmName:"总磷"},{name:"028",parmName:"总镍"},{name:"024",parmName:"六价铬"}];
		/**
		 * 政区开关点击事件
		 */
		$scope.onAreaShowClick = function(){
			$scope.areaShow = !$scope.areaShow;
		}
		
		/**
		 * 政区选择事件
		 */
		$scope.onAreaChange = function(area){
			$scope.areaShow = !$scope.areaShow;
			$scope.selectArea = area.v;
			var extent = new esri.geometry.Extent(area.MINX,area.MINY,area.MAXX,area.MINY,$gisObject.map.spatialReference);
			$gisObject.map.setExtent(extent);
			$pubSubService.publish("mapAreaChange",area);
		}
		
		/**
		 * 加载政区数据
		 */
		function _initArea(){
			$districtService.getDistrictDomain().then(function(data){
				$scope.area = data.qu;
			});
		}
		_initArea();
	});
}(window, angular));


